﻿using Microsoft.EntityFrameworkCore;
using RbacPermissionSystem.Domain;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace RbacPermissionSystem.Repositories
{
    public class RbacDbContext : DbContext
    {
        public RbacDbContext(DbContextOptions options) : base(options)
        {
        }

        public DbSet<Admin> Admins { get; set; }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<Admin>(m => {
                m.Property(p => p.UserName).IsRequired().HasMaxLength(50);
                m.Property(p => p.Password).IsRequired().HasMaxLength(50);
                m.Property(p => p.Email).HasMaxLength(50);
                m.Property(p => p.FullName).HasMaxLength(50);
                m.Property(p => p.LastLoginIP).HasMaxLength(50);
                m.Property(p => p.Avatar).HasMaxLength(500);
            });



            base.OnModelCreating(modelBuilder);
        }
    }
}
